package org.jeecg.common.es.service;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.jeecg.common.es.entity.EsEntity;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.CriteriaQuery;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author wangzun1.vendor@sensetime.com
 * @Description:
 * @date 2022/8/10
 */
public interface EsService {

    <T extends EsEntity> void createIndex(List<T> var1);

    <T extends EsEntity> void createIndex(T var1);

    <T extends EsEntity> void save(T var1);

    <T extends EsEntity> void save(List<T> var1);

    <T extends EsEntity> SearchHits<T> search(CriteriaQuery var1, Class<T> var2);

    SearchHits search(NativeSearchQueryBuilder var1, Class<? extends EsEntity> var2, boolean var3);

    SearchResponse search(SearchRequest var1);

    String[] getAllIndex(String var1) throws IOException;

    void refreshByIndexName(String var1);

    void deleteIndex(String var1);

    boolean deleteByQuerySync(CriteriaQuery var1, Class<? extends EsEntity> var2, int var3);

    boolean deleteByIdSync(Collection<String> var1, Class<? extends EsEntity> var2);

    void deleteByQueryAsync(CriteriaQuery var1, Class<? extends EsEntity> var2,
        ActionListener<BulkByScrollResponse> var3);

    void batchUpdateByQuery(Set<String> var1, Class<? extends EsEntity> var2, Map<String, Object> var3)
        throws IOException;

    <T extends EsEntity> void batchUpdateByQuery(List<T> var1) throws IOException, IllegalAccessException;

    void updateByQuery(String var1, Class<? extends EsEntity> var2, Map<String, Object> var3);

    <T extends EsEntity> void updateByQuery(T var1) throws IllegalAccessException;

    void update(String var1, String var2, Class<? extends EsEntity> var3, Map<String, Object> var4);

    <T extends EsEntity> void update(T var1) throws IllegalAccessException;
}
